package com.example.ck.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.ck.dao.ExpertsignDao;
import com.example.ck.entity.Expertsign;
import com.example.ck.service.ExpertsignService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 专家签名表(Expertsign)表服务实现类
 *
 * @author makejava
 * @since 2024-03-26 21:59:40
 */
@Service
public class ExpertsignServiceImpl implements ExpertsignService {
    @Autowired
    private ExpertsignDao expertsignDao;

    @Override
    public boolean addExpertsign(Expertsign expertsign) {
        int i = expertsignDao.insert(expertsign);
        return i > 0;
    }

    @Override
    public Expertsign findExpertsign(String expertName) {
        QueryWrapper qw = new QueryWrapper<>();
        qw.eq("expert_name", expertName);
        Expertsign expertsign = expertsignDao.selectOne(qw);
        return expertsign;
    }

    @Override
    public boolean updateExpertsign(String expertName, String expertsign) {
        QueryWrapper qw = new QueryWrapper<>();
        qw.eq("expert_name", expertName);
        Expertsign expertsign1 = new Expertsign();
        expertsign1.setExpertSign(expertsign);
        int i = expertsignDao.update(expertsign1, qw);
        return i > 0;
    }

}
